package com.ddyx.rest;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import com.ddyx.entity.EventClickLike;
import com.ddyx.mapper.EventClickFavoriteMapper;
import com.ddyx.service.EventClickFavoriteService;
import com.ddyx.service.EventClickLikeService;
import com.ddyx.service.EventClickShareService;
import com.ddyx.service.IEventAttenStoreService;
import com.ddyx.service.IEventClickPageviewService;
import com.ddyx.util.RequestForm;
import com.ddyx.util.ResponseForm;

/**
 * @ClassName: EventController.java
 * @Description: 所有事件的接口
 * @author: liuhoujie
 * @date: 2017年12月22日
 */

@Controller
@RequestMapping("/event")
public class EventController {
	@Resource
	EventClickLikeService eventClickLikeService;

	@Resource
	EventClickFavoriteService eventClickFavoriteService;

	@Resource
	IEventClickPageviewService iEventClickPageviewService;
	
	@Resource
	IEventAttenStoreService iEventAttenStoreService;
	
	@Resource
	EventClickShareService ecsService;
	
	/**
	 * 客户新增点赞商品事件
	 */
	@ResponseBody
	@RequestMapping(value = "insertEventClickLike", method = RequestMethod.POST)
	public ResponseForm insertEventClickLike(@RequestBody RequestForm param, HttpServletRequest req) {
		return eventClickLikeService.insertEventClickLike(param, req);

	}

	/**
	 * 客户取消点赞商品事件
	 */
	@ResponseBody
	@RequestMapping(value = "cancelEventClickLike", method = RequestMethod.POST)
	public ResponseForm cancelEventClickLike(@RequestBody RequestForm param, HttpServletRequest req) {
		return eventClickLikeService.cancelEventClickLike(param, req);
	}

	/**
	 * 根据客户获取点赞商品列表
	 */
	@ResponseBody
	@RequestMapping(value = "findEventClickLikeByCustomer", method = RequestMethod.POST)
	public ResponseForm findEventClickLikeByCustomer(@RequestBody RequestForm param) {
		return eventClickLikeService.findEventClickLikeByCustomer(param);
	}

	/**
	 * 客户新增收藏商品事件
	 */
	@ResponseBody
	@RequestMapping(value = "insertEventClickFavorite", method = RequestMethod.POST)
	public ResponseForm insertEventClickFavorite(@RequestBody RequestForm param, HttpServletRequest req) {
		return eventClickFavoriteService.insertEventClickFavorite(param, req);

	}

	/**
	 * 客户取消收藏商品事件
	 */
	@ResponseBody
	@RequestMapping(value = "cancelEventClickFavorite", method = RequestMethod.POST)
	public ResponseForm cancelEventClickFavorite(@RequestBody RequestForm param, HttpServletRequest req) {
		return eventClickFavoriteService.cancelEventClickFavorite(param, req);
	}

	/**
	 * 根据客户查询收藏商品列表
	 */
	@ResponseBody
	@RequestMapping(value = "findEventClickFavoriteByCustomer", method = RequestMethod.POST)
	public ResponseForm findEventClickFavoriteByCustomer(@RequestBody RequestForm param) {
		return eventClickFavoriteService.findEventClickFavoriteByCustomer(param);
	}

	/**
	 * 客户浏览首页接口
	 */
	@ResponseBody
	@RequestMapping(value = "insertPageview", method = RequestMethod.POST)
	public ResponseForm insertPageview(@RequestBody RequestForm param, HttpServletRequest req) {
		return iEventClickPageviewService.insertPageview(param, req);
	}
	
	
	/**
	 * 客户关注门店接口
	 */
	@ResponseBody
	@RequestMapping(value = "insertAttenStore", method = RequestMethod.POST)
	public ResponseForm insertAttenStore(@RequestBody RequestForm param,HttpServletRequest req) {
		return iEventAttenStoreService.insertAttenStore(param,req);
	}
	/**
	 * 客户取消关注门店接口
	 */
	@ResponseBody
	@RequestMapping(value = "cancelAttenStore", method = RequestMethod.POST)
	public ResponseForm cancelAttenStore(@RequestBody RequestForm param,HttpServletRequest req) {
		return iEventAttenStoreService.cancelAttenStore(param,req);
	}

	/**
	 * 获取用户所有浏览商品记录信息 接口
	 */
	@ResponseBody
	@RequestMapping(value = "getCustomerAllPV", method = RequestMethod.POST)
	public ResponseForm getCustomerAllPV(@RequestBody RequestForm param) {
		return iEventClickPageviewService.getCustomerAllPV(param);
	}
	
	/**
	 * 用户分享记录
	 */
	@ResponseBody
	@RequestMapping(value = "v1.5/addShare", method = RequestMethod.POST)
	public ResponseForm addShare(@RequestBody RequestForm param) {
		return ecsService.addShare(param);
	}
	
	/**
	 * 获取用户浏览过的商品(区分门店)
	 */
	@ResponseBody
	@RequestMapping(value = "v1.5/getBrowsedGoods", method = RequestMethod.POST)
	public ResponseForm getBrowsedGoods(@RequestBody RequestForm param) {
		return iEventClickPageviewService.getBrowsedGoods(param);
	}
	/**
	 * 获取用户浏览过店铺
	 */
	@ResponseBody
	@RequestMapping(value = "v1.5/getBrowsedStore", method = RequestMethod.POST)
	public ResponseForm getBrowsedStore(@RequestBody RequestForm param) {
		return iEventClickPageviewService.getBrowsedStore(param);
	}
}
